$(function() {
    $("#login").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 200,
            width: 300,
            modal: true,
            buttons: {
		'Enter': function() {
		    $('.sym_user_signin form').submit();
		}
            },
            close: function(){
		
            }
    });
    if($('#is_logged_in').html()=='0'){
        $('#login').dialog('open');
    }
    
    
    $('.symbiosis-hover').hover(function(){
	$(this).addClass('ui-state-hover');
    },function(){
	$(this).removeClass('ui-state-hover');
    });
    
    $('.symbiosis-button').button();
    $('.symbiosis-button-add').button({icons: {primary:'ui-icon-circlesmall-plus'}});
    
    //Processbar:
    $('.symbiosis-progressbar').progressbar({
	value: 0
    }).hide();
    $('.symbiosis-progressbar').ajaxStart(function(event,request, settings){
	$('.symbiosis-progressbar').show();
    });
    $('.symbiosis-progressbar').ajaxSend(function(event,request, settings){
	$.symbiosis.ajaxLoads++;
	value=(100/$.symbiosis.ajaxLoads)*$.symbiosis.ajaxLoadsComplete;
	$('.symbiosis-progressbar').progressbar('option', 'value', value);
    });
    $('.symbiosis-progressbar').ajaxSuccess(function(event,request, settings){
	$.symbiosis.ajaxLoadsComplete++;
	value=(100/$.symbiosis.ajaxLoads)*$.symbiosis.ajaxLoadsComplete;
	$('.symbiosis-progressbar').progressbar('option', 'value', value);
    });
    $('.symbiosis-progressbar').ajaxStop(function(event,request, settings){
	setTimeout(function(){
	    $('.symbiosis-progressbar').hide();
	    $.symbiosis.ajaxLoads=0;
	    $.symbiosis.ajaxLoadsComplete=0;
	    $('.symbiosis-progressbar').progressbar('option', 'value', 0);
	},1000);
    });
    
});
